﻿<%@ Page language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

    protected void ProductListView_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head id="Head1" runat="server">
    <title>ListView Flow Layout Example</title>
    <style type="text/css">
      .plainBox {
          font-family: Verdana, Arial, sans-serif;
          font-size: 11px;
          background: #ffffff;
          border:1px solid #336666;
          }
    </style>
  </head>
  <body>
    <form id="form1" runat="server">

      <h3>ListView Flow Layout Example</h3>

      Select the color:
      <asp:DropDownList ID="ColorList" runat="server" 
        AutoPostBack="True" 
        DataSourceID="ColorDataSource" 
        DataTextField="status" 
        DataValueField="id_status">
          <asp:ListItem>7777</asp:ListItem>
      </asp:DropDownList><br /><br />

      <asp:ListView runat="server" ID="ProductListView"
        DataSourceID="ProductsDataSource"
        DataKeyNames="id_users" 
          onselectedindexchanged="ProductListView_SelectedIndexChanged">
        <LayoutTemplate>
            <table runat="server">
                <tr runat="server">
                    <td runat="server">
                        <table ID="itemPlaceholderContainer" runat="server" border="0" style="">
                            <tr runat="server" style="">
                                <th runat="server">
                                    id_users</th>
                                <th runat="server">
                                    nick</th>
                                <th runat="server">
                                    name</th>
                                <th runat="server">
                                    lastname</th>
                                <th runat="server">
                                    middlename</th>
                                <th runat="server">
                                    id_status</th>
                            </tr>
                            <tr ID="itemPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server">
                    <td runat="server" style="">
                        <asp:DataPager ID="DataPager1" runat="server">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                    ShowLastPageButton="True" />
                            </Fields>
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
          <AlternatingItemTemplate>
              <tr style="">
                  <td>
                      <asp:DynamicControl runat="server" DataField="id_users" Mode="ReadOnly" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="nick" Mode="ReadOnly" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="name" Mode="ReadOnly" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="lastname" Mode="ReadOnly" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="middlename" Mode="ReadOnly" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="id_status" Mode="ReadOnly" />
                  </td>
              </tr>
          </AlternatingItemTemplate>
          <EditItemTemplate>
              <tr style="">
                  <td>
                      <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                          Text="Обновить" />
                      <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                          Text="Отмена" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="id_users" Mode="ReadOnly" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="nick" Mode="Edit" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="name" Mode="Edit" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="lastname" Mode="Edit" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="middlename" Mode="Edit" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="id_status" Mode="Edit" />
                  </td>
              </tr>
          </EditItemTemplate>
          <EmptyDataTemplate>
              <table runat="server" style="">
                  <tr>
                      <td>
                          Нет данных.</td>
                  </tr>
              </table>
          </EmptyDataTemplate>
          <InsertItemTemplate>
              <tr style="">
                  <td>
                      <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                          Text="Вставить" ValidationGroup="Insert" />
                      <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                          Text="Очистить" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="id_users" Mode="Insert" 
                          ValidationGroup="Insert" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="nick" Mode="Insert" 
                          ValidationGroup="Insert" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="name" Mode="Insert" 
                          ValidationGroup="Insert" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="lastname" Mode="Insert" 
                          ValidationGroup="Insert" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="middlename" Mode="Insert" 
                          ValidationGroup="Insert" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="id_status" Mode="Insert" 
                          ValidationGroup="Insert" />
                  </td>
              </tr>
          </InsertItemTemplate>
        <ItemTemplate>
            <tr style="">
                <td>
                    <asp:DynamicControl runat="server" DataField="id_users" Mode="ReadOnly" />
                </td>
                <td>
                    <asp:DynamicControl runat="server" DataField="nick" Mode="ReadOnly" />
                </td>
                <td>
                    <asp:DynamicControl runat="server" DataField="name" Mode="ReadOnly" />
                </td>
                <td>
                    <asp:DynamicControl runat="server" DataField="lastname" Mode="ReadOnly" />
                </td>
                <td>
                    <asp:DynamicControl runat="server" DataField="middlename" Mode="ReadOnly" />
                </td>
                <td>
                    <asp:DynamicControl runat="server" DataField="id_status" Mode="ReadOnly" />
                </td>
            </tr>
        </ItemTemplate>
          <SelectedItemTemplate>
              <tr style="">
                  <td>
                      <asp:DynamicControl runat="server" DataField="id_users" Mode="ReadOnly" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="nick" Mode="ReadOnly" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="name" Mode="ReadOnly" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="lastname" Mode="ReadOnly" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="middlename" Mode="ReadOnly" />
                  </td>
                  <td>
                      <asp:DynamicControl runat="server" DataField="id_status" Mode="ReadOnly" />
                  </td>
              </tr>
          </SelectedItemTemplate>
      </asp:ListView>

      <!-- This example uses Microsoft SQL Server and connects      -->
      <!-- to the AdventureWorks sample database. Use an ASP.NET    -->
      <!-- expression to retrieve the connection string value       -->
      <!-- from the Web.config file.                                -->
      <asp:SqlDataSource ID="ProductsDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SevTwitterConnectionString %>"            	        
        SelectCommand="SELECT * FROM [Users]" >
      </asp:SqlDataSource>

      <asp:SqlDataSource ID="ColorDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SevTwitterConnectionString %>" 
        SelectCommand="SELECT * FROM [Status]">
        <SelectParameters>
          <asp:ControlParameter ControlID="ColorList" Name="Color" 
            PropertyName="SelectedValue" />
        </SelectParameters>
      </asp:SqlDataSource>

    </form>
  </body>
</html>

